var CandidateCourse = {
	getCourseGrid: function() {
		ajax({
			  url: baseURL + "candidate/course",
			  cache: false,
			  type: "POST",
			  data: $('#ajax_form').serialize(),
			  async: false,
			  dataType: 'html',
			  success: function(data) {
				  $('#gridCourse').html(data);
			  }
			});
	},
	
	getCourseLevel: function() {
		ajax({
			  url: baseURL + "ajax/get_course_level",
			  cache: false,
			  type: "POST",
			  async: false,
			  dataType: 'html',
			  success: function(data) {
				  $('#courseLevel').html(data);
			  }
			});
	},
	
	getCourseType: function() {
		if ($('#idlevel').val()) {
			ajax({
				  url: baseURL + "ajax/get_course_type",
				  cache: false,
				  type: "POST",
				  async: false,
				  data: 'idlevel=' + $('#idlevel').val(),
				  dataType: 'html',
				  success: function(data) {
					  $('#courseType').html(data);
				  }
				});
		} else {
			$('#courseType').html('<div>' + ajax_lang[1] + '</div>');
		}
	},
	
	getCourseStatus: function() {
		ajax({
			  url: baseURL + "ajax/get_course_status",
			  cache: false,
			  type: "POST",
			  async: false,
			  dataType: 'html',
			  success: function(data) {
				  $('#courseStatus').html(data);
			  }
			});
	},
	
	editCourse: function(idcourse) {
		$.facebox(function() {
			ajax({
			  url: baseURL + "candidate/course/edit/" + idcourse,
			  cache: false,
			  type: "POST",
			  async: false,
			  dataType: 'html',
			  success: function(data) { $.facebox(data) }
			});
		});
		
		return false;
	},
	
	processCourse: function() {
		ajax({
		  url: baseURL + "candidate/course/" + ($('#idcourse').val() ? 'update' : 'insert'),
		  cache: false,
		  type: "POST",
		  data: $('#ajax_form').serialize(),
		  async: false,
		  dataType: 'script'
		});
		
		return false;
	},
	
	deleteCourse: function(idcourse) {
		ajax({
			  url: baseURL + "candidate/course/delete",
			  cache: false,
			  type: "POST",
			  data: 'id=' + idcourse,
			  async: false,
			  dataType: 'script'
			});
			
			return false;
	}
};